package uk.ac.lkl.lpp.model.xml;



import java.util.logging.Logger;

import uk.ac.lkl.lpp.model.PedagogyPlanModel;
import uk.ac.lkl.lpp.xml.XMLException;
import uk.ac.lkl.lpp.xml.ElementProcessor;

import org.w3c.dom.Document;
import org.w3c.dom.Element;
//import org.w3c.dom.NodeList;

import uk.ac.lkl.lpp.PedagogyPlan;


public abstract class ModelElementProcessor extends ElementProcessor {

    private static final Logger logger = Logger.getLogger("uk.ac.lkl.lpp");


    public ModelElementProcessor(String elementName) {
        super(elementName);
    }


    @Override
    public final void convertElementToData(PedagogyPlan plan,
                                           Element parentElement)
            throws XMLException {
        PedagogyPlanModel model = plan.getModel();

        convertElementToData(model, parentElement);
    }


    protected abstract void convertElementToData(PedagogyPlanModel model,
                                                 Element parentElement)
            throws XMLException;


    @Override
    public final void convertDataToElements(PedagogyPlan plan,
                                            Document document,
                                            Element pedagogyPlanElement) {
        PedagogyPlanModel model = plan.getModel();
        convertDataToElements(model, document, pedagogyPlanElement);
    }


    protected abstract void convertDataToElements(PedagogyPlanModel model,
                                                  Document document,
                                                  Element pedagogyPlanElement);
}
